import redis
import time
import oss2
import os
import json


r = redis.StrictRedis(host='r-2zeizp1o4ad67jfx4h.redis.rds.aliyuncs.com', port=6379, db=0, password='api:2kZqgfvJ2I4t')

while True:
    index = 0
    sdinput = r.lindex("painter:queue1", index)
    if sdinput == None:
        index = 0
        time.sleep(1)
        continue
    queueSize = r.llen("painter:queue1")
    arr = json.loads(str(sdinput, encoding="utf-8"))
    taskKey = "painter:task:" + arr['task_id']
    r.hset(taskKey, 'index', index+1)
    r.hset(taskKey, 'size', index+1)
    r.hset(taskKey, 'time', (index+1)*17)




